var isGET = document.location.href.indexOf('?id=');
var isShort = document.location.href.indexOf('index.php/');
var id = (!isGET) ? document.location.href.substring(isGET + 5, document.location.href.length) : document.location.href.substring(isShort + 10, document.location.href.length);
var URLa  = document.location.href.substring(0, document.location.href.indexOf('index.php'));
window.addEvent('domready', function(){
	if(!$('vComment'))return;
	$('vComment').addEvent('click', showComment);
	var slider = new Fx.Slide('formWriteC', {duration: 1000});
	slider.hide();
	$('dComment').addEvent('click', function(ev)	{
		new Event(ev).stop();
		slider.toggle();
	});
});
function showComment(){
	var myHTML = new Request.HTML({method: 'get', url: URLa+'/show_comments.php', update: $('shower')});
	myHTML.send('id='+id);
	return false;
}

var Nome = new LiveValidation("name", { validMessage: "Ok!", wait: 1500} );
Nome.add(Validate.Presence,  {failureMessage: "Este campo es obligatorio"} );
Nome.add(Validate.Length, { minimum: 3, maximum: 20, tooShortMessage: "Debe escribir mínimo 3 caracteres", tooLongMessage: "Nombre demasido largo"} );
var Email = new LiveValidation("email", { validMessage: "Ok!", wait: 1500} );
Email.add(Validate.Presence,  {failureMessage: "Este campo es obligatorio"} );
Email.add(Validate.Email,  {failureMessage: "Escriba un e-mail válido"} );
Email.add(Validate.Length, { minimum: 5, maximum: 500, tooShortMessage: "Debe escribir mínimo 5 caracteres", tooLongMessage: "Email demasido largo"} );
var Text = new LiveValidation("text", { validMessage: "Ok!", wait: 1500} );
Text.add(Validate.Presence,  {failureMessage: "Este campo es obligatorio" } );
Text.add(Validate.Length, { minimum: 3, maximum: 500, tooShortMessage: "Debe escribir mínimo 3 caracteres", tooLongMessage: "Comentario demasido largo"} );
var Captcha = new LiveValidation("captcha", { validMessage: "Ok!", wait: 1500} );
Captcha.add(Validate.Presence,  {failureMessage: "Este campo es obligatorio" } );
